package bsc.war.ajax;

import bsc.ejb.entity.Project;
import bsc.war.delegate.DelegateBSC;
import bsc.war.factory.Factory;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;

/**
 *
 * @author Miguel Angel
 */
public class AddUpdateDataProject extends AbstractController {

    @Override
    protected ModelAndView handleRequestInternal(HttpServletRequest request,
            HttpServletResponse response) throws Exception {


        DelegateBSC delegate = (DelegateBSC) Factory.getBean("DelegateBSC");
        ModelAndView mav = new ModelAndView("updateDataProject");
        //Find the scorecard
        Long idProject = Long.parseLong(request.getParameter("scoreCard"));
        Project project = (Project) delegate.findScoreCard(idProject);
        /*
        response.setContentType("application/vnd.ms-excel"); //Tipo de fichero.
        response.setHeader("Content-Disposition", "attachment;filename=\"report.xls\"");
         */
        request.setAttribute("scoreCard", project);

        return mav;
    }
}
